#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
using namespace std;

int id[100010];

int main()
{
    int max = 0, min = 0x3f3f3f3f;
    int x;
    while (scanf("%d", &x) != EOF)
    {
        if (x > max) max = x;
        if (x < min) min = x;
        id[x]++;
    }
    int m, n;
    for (int i = min; i <= max; i++)
    {
        if (id[i] == 0) m = i;
        if (id[i] == 2) n = i;
    }
    cout << m << " " << n << endl;
    return 0;
}